import Vue from 'vue'
import Vuex from 'vuex'

import getters from './getters'

// 持久化插件
// npm i -S vuex-persistedstate
import persistedState from 'vuex-persistedstate'

import user from './modules/user'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    user
  },
  getters,
  plugins: [
    persistedState({
      key: 'store',
      storage: window.sessionStorage,
      paths: ['user']
    })
  ]
})
export default store
